﻿using System.Collections.Generic;

namespace WorldMapBase
{
    public class TrafficLODLayerContainer : LODLayerContainer
    {
        private int enableLayer = -1;

      
        protected override void LODLevelChange(int currentLodLevel, int lastLodLevel)
        {
            if (currentLodLevel != enableLayer)
            {
                // 隐藏之前LOD的层级
                DisableLayer(enableLayer);
                // 激活当前LOD的层级
                EnableLayer(currentLodLevel);
                // UnityEngine.Debug.LogError(string.Format("开启层级：{0}  关闭层级：{1}", currentLodLevel, enableLayer));
                enableLayer = currentLodLevel;
            }
        }

        protected override void NextLODPercentUpdate(int lodLevel, float nextLevelPercent)
        {
            m_LodLevel = lodLevel;
            m_NextLevelPercent = nextLevelPercent;
            b_RefreshPercent = true;

            var layer = GetLayer(m_LodLevel) as ILODPercentListener;
            layer?.OnUpdateLODPercent(m_LodLevel, m_NextLevelPercent);

        }

        protected override void OnUpdate()
        {

        }
    }
}